package com.fd.operator;

public class OperayorDome1 {
    public static void main(String[] args) {
        receive(5);
    }

    public static void receive(int b) {
        int a = 100;
        a += b; //等价于 a = (a的类型)(a + b)
        System.out.println("收货了" + a);

        byte a1 = 10;
        byte a2 = 20;
        a1 += a2;//等价于 a1 = (byte)(a1 + a2); 扩展赋值运算符自带强制类型转换。
        System.out.println(a1);
    }

    // 需求： 帮我在演示一下其他几个扩展的赋值运算符
    public static void demo() {
        int a = 10;
        a -= 5; //等价于 a = (a - 5)
        System.out.println(a);
        a *= 5; //等价于 a = (a * 5)
        System.out.println(a);
        a /= 5; //等价于 a = (a / 5)
        System.out.println(a);
        a %= 5; //等价于 a = (a % 5)
        System.out.println(a);
    }

    public static void demo1() {
        int a = 10;
        a <<= 5; //等价于 a = (a << 5)
        System.out.println(a);
        a >>= 5; //等价于 a = (a >> 5)
        System.out.println(a);
        a >>>= 5; //等价于 a = (a >>> 5)
        System.out.println(a);
        a &= 5; //等价于 a = (a & 5)
        System.out.println(a);
    }
}
